﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Index.aspx.cs" Inherits="LabMS.Web.Post.BBS.Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>在线交流 - 交流首页</title>
    <link type="text/css" rel="stylesheet" href="../../style/screen.css" />
    <link href="../../style/post.css" rel="stylesheet" type="text/css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../../style/ie7.css" />
    <![endif]-->
</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        在线交流</label>
                </div>
            </div>
        </div>
        <% ExtendBLL.PostPlate pp = new ExtendBLL.PostPlate();
           for (int i = 0; i < sections.Tables[0].Rows.Count; i++)
           {
               System.Data.DataRow row = sections.Tables[0].Rows[i];
               System.Data.DataSet plates = pp.GetSubPlates(int.Parse(row["ID"].ToString()), true);
        %>
        <div class="section main">
            <div class="sectionTitleContainer clearfix">
                <div class="sectionTitle">
                    <a href='javascript:;'>
                        <%= row["Name"].ToString() %>
                    </a>
                </div>
                <div class="sectionAction">
                    <%= row["Description"].ToString() %>
                </div>
                <input type="hidden" value='<%= row["ID"].ToString() %>' />
            </div>
            <div class="plate clearfix">
                <% 
                    ExtendBLL.Post post = new ExtendBLL.Post();
                    for (int j = 0; j < plates.Tables[0].Rows.Count; j++)
                    {
                        System.Data.DataRow plateRow = plates.Tables[0].Rows[j];
                        string todayCount = plateRow["PostCountToday"].ToString();
                        int subjectCount = post.GetPostCountInPlate(int.Parse(plateRow["ID"].ToString()));
                %>
                <div class="plateItem">
                    <table cellpadding="4" cellspacing="0" border="0">
                        <tr valign="top">
                            <td>
                                <% if (!string.IsNullOrEmpty(todayCount) && (todayCount != "0"))
                                   { %>
                                <img src="../../Images/forum_new.gif" alt="今日有新帖" title="今日有新帖" />
                                <%}
                                  else
                                  { %>
                                <img src="../../Images/forum.gif" alt="今日暂无新贴" title="今日暂无新贴" />
                                <%}
                                %>
                            </td>
                            <td valign="top">
                                <div class="plateTitle">
                                    <a href="javascript:;">
                                        <%= plateRow["Name"].ToString() %>
                                    </a>
                                </div>
                                <p>
                                    主题数:
                                    <%= subjectCount %>
                                </p>
                                <p>
                                    总贴数:
                                    <%= plateRow["TotalPostsInPlate"].ToString() %>
                                    ,今日贴数:
                                    <%= todayCount %>
                                </p>
                                <input type="hidden" value='<%= plateRow["ID"].ToString() %>' />
                            </td>
                        </tr>
                    </table>
                </div>
                <% } %>
            </div>
        </div>
        <% } %>
    </form>

    <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript">
        $(function(){
            $("#btnAddSection").click(function(){
                var rv = window.showModalDialog("AddSection.aspx", window, 'dialogWidth=500px;dialogHeight=300px;help:no;status:no');
                if (rv != null && rv) {
                    window.location.replace(window.location);
                }
            });

            $("div.sectionTitle").find("a").click(function(e){
                var id = $(this).parent().parent().find("input[type='hidden']").val();
                window.location.href = "Section.aspx?id=" + id;
                e.preventDefault();
            });

            $("div.plateTitle").find("a").click(function(e){
                 var id= $(this).parent().parent().find("input[type='hidden']").val();
                 // window.location.href="DetailList.aspx?id="+id;
                 window.location.href="Plate.aspx?plateID="  + id;
                 e.preventDefault();
            });
        });
    </script>

</body>
</html>
